<template>
  <!--面包屑导航---位置信息-->
  <div class="iconfont  sd_position container">
    <router-link tab="span" to="/">{{base}}</router-link>&nbsp;：&nbsp;
    <a v-for="(bread,index) in breadcrumb" :key="bread.route.path">
      {{bread.name}}{{(index==breadcrumb.length-1)?'':'&nbsp;&gt;&nbsp;'}}
    </a>
  </div>
</template>

<script>
    export default {
        name: 'sample',
      props: {
        base: {default: '', type: String}
      },
      data() {
        return {}
      },
        methods: {},
        computed: {
          breadcrumb(){
            let vm=this
            let breadcrumb=vm.$route.matched
              .filter(route=>!!(route.meta.breadcrumb || {}).name)
              .map(route=>{
                if(route.meta && route.meta.breadcrumb){
                  return{
                    route,
                    ...route.meta.breadcrumb
                  }
                }
              }).filter(bread => !!bread)

            return breadcrumb
          }
        },
        created() {
            const vm = this
        },
    }
</script>

<style>
</style>
